<template>
 <a-modal v-model="currentVisible" :footer="null" width="800px" :title="title" @cancel="currentVisible = false">
  <a-table bordered :pagination="currentPagination" :columns="columns" :data-source="data"
             :rowKey="(record, index) => index" size="middle" @change="onPageChange">
             <span slot="logType" slot-scope="text, record, index">
              <!--  1打印2作废3延迟4补发-->
              <span v-if="record.logType == 1" >打印</span>
              <span v-if="record.logType == 2" >作废</span>
              <span v-if="record.logType == 3" >延期</span>
              <span v-if="record.logType == 4" >补发</span>
            </span>
    </a-table>
 </a-modal>
</template>
<script>
 const columns = [
    {
      title: '类型',
      width: 1,
      align: 'center',
      scopedSlots: { customRender: 'logType' }
    },
    {
      title: '操作时间',
      width: 2,
      align: 'center',
      dataIndex: 'createtime'
    },
    // {
    //   title: '操作人',
    //   width: 1,
    //   align: 'center',
    //   dataIndex: 'operateId'
    // },
    {
      title: '操作原因',
      width: 4,
      align: 'center',
      dataIndex: 'info'
    },
    {
      title: '备注',
      width: 3,
      align: 'center',
      dataIndex: 'remark'
    }
  ]
  export default {
    props: {
      title: {
        type: String,
        default: '批次日志记录'
      },
      visible: {
        type: Boolean,
        default: false
      },
      data: {
        type: Array,
        default: () => []
      },
      pagination: {
        type: Object,
        default: {
          current: 1,
          pageSize: 10,
          total: 0,
          showTotal: total => `共有 ${total} 条数据`
        }
      }
    },
    data() {
      return {
        columns
      }
    },
    computed: {
      currentVisible: {
        get () {
          return this.visible
        },
        set (val) {
          this.$emit('update:visible', val)
        }
      },
      currentPagination: {
        get () {
          return this.pagination
        },
        set (val) {
          this.$emit('update:pagination', val)
        }
      }
    },
    created() {
    },
    mounted() {
    },
    methods: {
      onPageChange(pagination) {
        this.currentPagination.current = pagination.current
        this.$emit('onPageChange', this.currentPagination)
      },
    }
  }
</script>
<style lang="less" scoped>
</style>
